home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
wsc4c21.zip
/
SIOERROR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-22
|
2KB
|
75 lines
/*** sioerror.c ***/
#include <stdio.h>
#include "windows.h"
#include "sioerror.h"
#include "wsc.h"
#include "paint.h"
void cdecl SioError(int Code, char *Text)
{static char Temp[80];
#ifdef WIN32
DWORD dwError;
char *Win32ErrMsg;
#endif
DisplayString(Text);
switch(Code)
{case WSC_NO_DATA:
DisplayLine("No Data");
break;
case WSC_RANGE:
DisplayLine("Parameter out of range");
break;
case WSC_ABORTED:
DisplayLine("Aborted");
break;
case WSC_EXPIRED:
DisplayLine("Shareware execution expired");
break;
case IE_BADID:
DisplayLine(" Invalid COM port\n");
break;
case IE_OPEN:
DisplayLine(" COM port already open\n");
break;
case IE_NOPEN:
DisplayLine(" Cannot open COM port\n");
break;
case IE_MEMORY:
DisplayLine(" Cannot allocate memory\n");
break;
case IE_DEFAULT:
DisplayLine(" Error in default parameters\n");
break;
case IE_HARDWARE:
DisplayLine(" COM port hardware not present\n");
break;
case IE_BYTESIZE:
DisplayLine(" Unsupported byte size\n");
break;
case IE_BAUDRATE:
DisplayLine(" Unsupported baud rate\n");
break;
#ifdef WIN32
case WSC_WIN32ERR:
dwError = (DWORD) SioWinError();
if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER|80 ,
NULL, dwError,
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPTSTR) &Win32ErrMsg, 0, NULL)
> 0)
{DisplayLine(Win32ErrMsg);
}
else
{sprintf(Temp," Win32 Error\n");
DisplayLine(Temp);
}
break;
#endif
default:
sprintf(Temp," Unknown code %d\n",Code);
DisplayLine(Temp);
break;
}
} /* end SioError */